#include "Utils.h"

using namespace br::org::core;

Utils* Utils::instance = 0;

Utils* Utils::get()
{
    if ( !instance )
    {
        instance = new Utils();
    }
    return instance;
}

Utils::Utils()
{
}

Utils::~Utils()
{
    delete instance;

    instance = 0;
}

bool Utils::isHorizontalMove( QKeyEvent* event )
{
    return isToLeft( event ) ||  isToRight( event );
}

bool Utils::isVerticalMove( QKeyEvent* event )
{
    return isToUp( event )  || isToDown( event );
}

bool Utils::isToLeft( QKeyEvent *event )
{
    return event->key() == Qt::Key_Left;
}

bool Utils::isToUp( QKeyEvent *event )
{
    return event->key() == Qt::Key_Up;
}

bool Utils::isToRight( QKeyEvent *event )
{
    return event->key() == Qt::Key_Right;
}

bool Utils::isToDown( QKeyEvent *event )
{
    return event->key() == Qt::Key_Down;
}
